
/* GENERATED CODE:
 *  Any modifications you make are guaranteed
 *  to be deleted when this is regenerated.
 * Please edit "PROTOCOLS" inside this directory
 *
 * Names are all upper case because of "String" and "string."
 */

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using OWED.Network.Messages.General;
using OWED.Network.Messages;
using OWED.Network.Messages.Reply;


namespace OWED.Network.Messages.Reply
{
	public class DocumentReply: IProtocolItem 
	{
		ADocument my_adocument;
		public DocumentReply (ADocument adocument)
		{
			my_adocument = adocument;
		}
		public ADocument ADocument { get { return my_adocument; } }


		public static new DocumentReply FromXml(XmlDocument xml)
		{
			XmlDocument doc;
			if (xml.SelectSingleNode("DocumentReply/ADocument") != null) {
				doc = new XmlDocument();
				doc.AppendChild(doc.ImportNode(xml.SelectSingleNode("DocumentReply/ADocument"), true));
				ADocument adocument = ADocument.FromXml(doc);

				return new DocumentReply(adocument);
			}
			throw new ConnectionException("Bad document supposedly of type:DocumentReply");
		}


		public override XmlDocument ToXml()		{
			XmlDocument doc = new XmlDocument();

			doc.AppendChild(doc.CreateElement("DocumentReply"));

			if (my_adocument != null) {
				XmlNode node;
				node = doc.ImportNode(my_adocument.ToXml().FirstChild, true);
				doc.FirstChild.AppendChild(node);
			}

			return doc;
		}
	}
}
